package com.lucenly.spell.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.lucenly.spell.R
import com.lucenly.spell.adapter.MySpellAdapter
import com.lucenly.spell.adapter.OrderAdapter
import com.lucenly.spell.base.BaseActivity
import com.lucenly.spell.databinding.ActivityMySpellBinding
import com.moregold.mvvmlib.ext.ext_doubleClick

class MySpellActivity : BaseActivity<ActivityMySpellBinding>() {
    override fun getViewBinding(): ActivityMySpellBinding {
        return ActivityMySpellBinding.inflate(layoutInflater,baseBinding.root,true)
    }

    override fun setTitle(): String {
        return "我的拼团"
    }

    override fun initData() {
        var list = arrayListOf<String>()
        for (i in 1..6){
            list.add(""+i)
        }
//        binding.content.setBackgroundColor(color)
        binding.recyclerView.layoutManager = LinearLayoutManager(context)
        val itemAdapter = MySpellAdapter(list, context!!)
        binding.recyclerView.adapter = itemAdapter
    }

    override fun initEvent() {
        binding.llOrder.ext_doubleClick {
            binding.llSpellStatus.visibility = View.GONE
            if (binding.llOrderStatus.visibility == View.VISIBLE){
                binding.llOrderStatus.visibility = View.GONE
                binding.ivOrderStatus.setImageResource(R.mipmap.jts)
            }else{
                binding.llOrderStatus.visibility = View.VISIBLE
                binding.ivOrderStatus.setImageResource(R.mipmap.jtx)
            }
        }
        binding.llSpell.ext_doubleClick {
            binding.llOrderStatus.visibility = View.GONE
            if (binding.llSpellStatus.visibility == View.VISIBLE){
                binding.llSpellStatus.visibility = View.GONE
                binding.ivSpellStatus.setImageResource(R.mipmap.jts)
            }else{
                binding.llSpellStatus.visibility = View.VISIBLE
                binding.ivSpellStatus.setImageResource(R.mipmap.jtx)
            }
        }
    }

    override fun startObserve() {
    }
}